<!DOCTYPE html>
<html>
<head>
    <script>
        window.jsTestIsAsync = true;
        window.isOnErrorTest = true;
    </script>
    <script src="../../resources/js-test.js"></script>
    <script src="resources/onerror-test.js"></script>
</head>
<body>
    <button onclick="null.mu()">Button.</button>
    <script>
        description("This test should trigger 'window.onerror' for the exception in the attribute handler, regardless of how it's set.");

        function callback(errorsHandled) {
            console.log(errorsHandled);
            if (errorsHandled === 3)
                finishJSTest();
        }

        dumpOnErrorArgumentValuesAndReturn(true, callback);

        document.write('<button onclick="null.mu()">Button 2</button>\n');

        var button3 = document.createElement("button");
        button3.textContent = "Button 3";
        button3.setAttribute("onclick", "null.mu()");
        document.body.appendChild(button3);

        var buttons = document.querySelectorAll('button');
        for (var i = 0; i < buttons.length; ++i) {
            buttons[i].click();
        }
    </script>
</body>
</html>
